This invention relates, generally, to object-oriented software design and, more particularly, to user customization of software products in object-oriented design.
Often, it is desirable to allow the functionality of a complex software system to be extended or customized without providing access to the primary compilation and linkage stream. In particular, it is frequently undesirable or impractical to allow user access to the physical build process.
For example, it may be impractical because development of software might be distributed across multiple environments, such as different organizations or physical locations. In another example, it may be impractical because a software product or application might be intended to be enhanced by a customer, without the customer being given the source code for rebuilding the software product.
Enhancement of software in procedural, non-object oriented implementations typically occurs through dynamic loading of an external, executable object file that implements a customized function. However, in object-oriented implementations, such a solution is unsatisfactory. Namely, the customized function would extend functionality of the application without being associated with any object class. Such a function is termed a global function, and is disfavored in object-oriented design. In particular, a global function is unsatisfactory because it sacrifices important advantages of object-oriented design, since it is not associated with an instance of a class.
In object-oriented design, certain features such as inheritance and polymorphism offer advantages. That is, inheritance capitalizes on code reuse for desirable saving of resources, and polymorphism maximizes overall behavioral consistency. Hence, instances of different classes, that are derived from a common base class, may be managed advantageously similarly.
However, in current implementations of object-oriented code, such as C++, inheritance and polymorphism are available only by compiling and linking a derived class with the definition and implementation of its base class. Unfortunately, this constraint prevents employment of derivation when the ancestral source code is unavailable.
Thus, a need exists for allowing dynamic loading of customized behavior for a derived class, when source code for its base class is unavailable, in object-oriented design implementations.
Pursuant to the present invention, shortcomings of the existing art are overcome and additional advantages are provided through the provision of a run-time customization capability by which functionality of a software application in a computer system is extended. An instance of a first class is instantiated. The first class has a same interface as a second class. The first and second classes enable respective first and second functionalities through respective first and second implementations of the same interface. The first implementation is dynamically loaded at run time.
In one embodiment, the dynamic loading involves locating the first implementation. Further, a transfer vector usable in accessing the first implementation is initialized. Moreover, the transfer vector is initialized, for instance, to have an indication of a location of the first implementation.
In another embodiment, a locator is used to locate a module comprising the first implementation. Programming code associated with the same interface is compiled prior to compilation of programming code associated with the first implementation.
The same interface and/or the first implementation can include object-oriented design. The same interface can include a declaration of a virtual function which is implemented in the first implementation. The first class can be a derived class.
Thus, the present invention advantageously provides object-oriented dynamic loading of, and access to, customized behavior for a derived class, notwithstanding unavailability of the source code for its base class.